#ifndef __SERVER_H_
#define __SERVER_H_

#include <stdio.h>
#include <stdbool.h>
#include <cJSON.h>

typedef struct {
	cJSON *root;
	cJSON *data;
	char *command;
	char *gwid;
} CLOUD_DATA;

typedef struct {
	const char *command;
	void (*local_func)(CLOUD_DATA *cloud_data);
} CLOUD_CMD;

int handle_server_data(char *topicName, void *data, int len);

void gw_publish_setting_rsp_data(char *msg, int msglen);
void gw_publish_notify_req_data(char *msg, int msglen);

//广播报警器MQTT消息
void gw_publish_broadcast_terminal_message(unsigned char *msg, int msglen);

//点播报警器MQTT消息
void gw_publish_terminal_message(char *terminal_devsn, unsigned char *msg, int msglen);

cJSON *cJSON_Create(char *command);

#endif //__SERVER_H_
